package com.lmiot.xyclick.Deving;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import com.lmiot.xyclick.Util.SpFlag;
import com.lmiot.xyclick.Activity.BaseActivity;
import com.lmiot.xyclick.Bind.FloatFragmentDetail;
import com.lkx.liandianqinew.R;
import com.youyi.yyviewsdklibrary.View.TitleBarView;

public class FloatActivity01 extends BaseActivity {
    private MyPagerAdpater adpater;
    private String mActionFlag;
    TitleBarView mIdTitleBar;
    ViewPager mIdViewpager;
    TabLayout mTabLayout;
    private int[] tabs = {R.string.sys_control, R.string.sys_user, R.string.sys_set, R.string.user_app, R.string.kuai};

    /* access modifiers changed from: protected */
    @Override // android.support.v7.app.AppCompatActivity, android.support.v4.app.SupportActivity, android.support.v4.app.FragmentActivity, com.lmiot.xyclick.Activity.BaseActivity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_float_edit);
        initView();
        String stringExtra = getIntent().getStringExtra(SpFlag.k);
        this.mActionFlag = getIntent().getStringExtra("actionFlag");
        this.mIdTitleBar.setTitle(stringExtra);
        this.mIdTitleBar.setOnItemClickListener(new TitleBarView.onItemClickListener() {
            /* class com.lmiot.xyclick.Deving.FloatActivity01.AnonymousClass1 */

            @Override // com.youyi.yyviewsdklibrary.View.TitleBarView.onItemClickListener
            public void onMenuClick(View view) {
            }

            @Override // com.youyi.yyviewsdklibrary.View.TitleBarView.onItemClickListener
            public void onTitleClick(View view) {
            }

            @Override // com.youyi.yyviewsdklibrary.View.TitleBarView.onItemClickListener
            public void onBackClick(View view) {
                FloatActivity01.this.finish();
            }
        });
        this.adpater = new MyPagerAdpater(getSupportFragmentManager());
        this.mIdViewpager.setOffscreenPageLimit(4);
        this.mIdViewpager.setAdapter(this.adpater);
        this.mTabLayout.setupWithViewPager(this.mIdViewpager);
        this.mTabLayout.setTabTextColors(getResources().getColor(R.color.text_gray), getResources().getColor(R.color.colorAccent));
        this.mIdViewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            /* class com.lmiot.xyclick.Deving.FloatActivity01.AnonymousClass2 */

            @Override // android.support.v4.view.ViewPager.OnPageChangeListener
            public void onPageScrollStateChanged(int i) {
            }

            @Override // android.support.v4.view.ViewPager.OnPageChangeListener
            public void onPageScrolled(int i, float f, int i2) {
            }

            @Override // android.support.v4.view.ViewPager.OnPageChangeListener
            public void onPageSelected(int i) {
            }
        });
    }

    private void initView() {
        this.mIdTitleBar = (TitleBarView) findViewById(R.id.id_title_bar);
        this.mTabLayout = (TabLayout) findViewById(R.id.tab_layout);
        this.mIdViewpager = (ViewPager) findViewById(R.id.id_viewpager);
    }

    class MyPagerAdpater extends FragmentPagerAdapter {
        public MyPagerAdpater(FragmentManager fragmentManager) {
            super(fragmentManager);
        }

        @Override // android.support.v4.app.FragmentPagerAdapter
        public Fragment getItem(int i) {
            FloatActivity01 floatActivity01 = FloatActivity01.this;
            return new FloatFragmentDetail(floatActivity01, floatActivity01.mActionFlag, i);
        }

        @Override // android.support.v4.view.PagerAdapter
        public CharSequence getPageTitle(int i) {
            FloatActivity01 floatActivity01 = FloatActivity01.this;
            return floatActivity01.getString(floatActivity01.tabs[i]);
        }

        @Override // android.support.v4.view.PagerAdapter
        public int getCount() {
            return FloatActivity01.this.tabs.length;
        }
    }
}
